class PageComonComponent {
    constructor() {
        this.template = `
            <div class="anu-page" style="width: 100%;">
                <router-view></router-view> 
            </div>    
        `;
        this.data = function () {
            return {
                adminController: {}
            }
        };
        this.mounted = function () {

        };
        this.methods = {
            service() {
                var self = this;
                // 老大 要 service  向current children 传送
                if (this.$children) {
                    this.$children[0].service();
                }
            },
            attachChildComponentReady() {
                var self = this;
                if (this.$root.$children && this.$root.$children.length > 0 && this.$root.$children[0].isAdmin) {
                    self.adminController = this.$root.$children[0];
                }
                if (self.adminController && self.adminController.anuInitPageReady) {
                    self.adminController.anuInitPageReady(self);
                }
            },
            onError(e) {
                if (this.$children && this.$children[0].onError) {
                    this.$children[0].onError(e);
                }
            }
        }
    }
}

module.exports = {
    PageComonComponent
};